import { EventDispatcher, BaseEvent } from 'three';
import HandlerManager from './HandlerManager';

type State = 'enable' | 'disable';

export interface HandlerEvent<T> {
  type: T;
  event: MouseEvent | TouchEvent;
}

abstract class AbstractHandler<T extends BaseEvent> extends EventDispatcher<T> {
  protected _handlerManager: HandlerManager;
  protected _state: State = 'enable';

  constructor(handlerManager: HandlerManager) {
    super();
    this._handlerManager = handlerManager;
  }

  enable() {
    this._state = 'enable';
  }

  disable() {
    this._state = 'disable';
  }
}

export default AbstractHandler;
